import request from '../utils/request'

export function learningPlanByUserId (userId) {
  return request({
    url: `/learning/plan/${userId}`,
    method: 'get'
  })
}

export function learningPlanByUser () {
  return request({
    url: '/learning/plan/',
    method: 'get'
  })
}

export function learningPlanSave (learningPlan) {
  return learningPlanListSave([learningPlan])
}

export function learningPlanListSave (learningPlans) {
  return request({
    url: '/learning/plan/',
    method: 'post',
    data: learningPlans
  })
}

export function learningPlanDelete (learningPlan) {
  return learningPlanListDelete([learningPlan])
}

export function learningPlanListDelete (learningPlans) {
  return request({
    url: '/learning/plan/',
    method: 'delete',
    data: learningPlans
  })
}

export function learningPlanCompleted (learningPlan) {
  return learningPlanListCompleted([learningPlan])
}

export function learningPlanListCompleted (learningPlans) {
  return request({
    url: '/learning/plan/completed',
    method: 'put',
    data: learningPlans
  })
}

export function learningPlanEnable (learningPlan) {
  return learningPlanListEnable([learningPlan])
}

export function learningPlanListEnable (learningPlans) {
  return request({
    url: '/learning/plan/enable',
    method: 'put',
    data: learningPlans
  })
}
